package com.employ.job.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.employ.common.annotation.Log;
import com.employ.common.core.controller.BaseController;
import com.employ.common.core.domain.AjaxResult;
import com.employ.common.enums.BusinessType;
import com.employ.job.domain.EmpInterviews;
import com.employ.job.service.IEmpInterviewsService;
import com.employ.common.utils.poi.ExcelUtil;
import com.employ.common.core.page.TableDataInfo;

/**
 * 面试安排Controller
 * 
 * @author ruoyi
 * @date 2025-02-24
 */
@RestController
@RequestMapping("/job/interviews")
public class EmpInterviewsController extends BaseController
{
    @Autowired
    private IEmpInterviewsService empInterviewsService;

    /**
     * 查询面试安排列表
     */
    @PreAuthorize("@ss.hasPermi('job:interviews:list')")
    @GetMapping("/list")
    public TableDataInfo list(EmpInterviews empInterviews)
    {
        startPage();
        List<EmpInterviews> list = empInterviewsService.selectEmpInterviewsList(empInterviews);
        return getDataTable(list);
    }

    /**
     * 导出面试安排列表
     */
    @PreAuthorize("@ss.hasPermi('job:interviews:export')")
    @Log(title = "面试安排", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EmpInterviews empInterviews)
    {
        List<EmpInterviews> list = empInterviewsService.selectEmpInterviewsList(empInterviews);
        ExcelUtil<EmpInterviews> util = new ExcelUtil<EmpInterviews>(EmpInterviews.class);
        util.exportExcel(response, list, "面试安排数据");
    }

    /**
     * 获取面试安排详细信息
     */
    @PreAuthorize("@ss.hasPermi('job:interviews:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(empInterviewsService.selectEmpInterviewsById(id));
    }

    /**
     * 新增面试安排
     */
    @PreAuthorize("@ss.hasPermi('job:interviews:add')")
    @Log(title = "面试安排", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EmpInterviews empInterviews)
    {
        return toAjax(empInterviewsService.insertEmpInterviews(empInterviews));
    }

    /**
     * 修改面试安排
     */
    @PreAuthorize("@ss.hasPermi('job:interviews:edit')")
    @Log(title = "面试安排", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EmpInterviews empInterviews)
    {
        return toAjax(empInterviewsService.updateEmpInterviews(empInterviews));
    }

    /**
     * 删除面试安排
     */
    @PreAuthorize("@ss.hasPermi('job:interviews:remove')")
    @Log(title = "面试安排", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(empInterviewsService.deleteEmpInterviewsByIds(ids));
    }
}
